package org.icress.fusion.moc

import org.icress.fusion.shiro.User


class Adjust {//借入借出工时，即工时调整

    def adjustService

    String from
    String to
    Date date
    BigDecimal hour 

    String desc //备注

    Date dateCreated//创建日期
    Date lastUpdated//修改日期

    User owner
    User createdBy
    User lastModifiedBy

    static constraints = {
        from(nullable:false, blank:false, maxSize:20)
        to(nullable:false, blank:false, maxSize:20, validator: { val, obj ->
            obj.properties['from'] != val
        })
        date(nullable:false, validator:{val, obj ->
            return obj.adjustService.validateLockdate(val)
        })
        hour(nullable:false, min : new BigDecimal(0.00001), scale:5)
        desc(nullable:true, blank:true, maxSize : 255)
        owner(nullable:false)
    }

    static mapping = {
		table 'MOC$ADJUST'
        autoTimestamp   true
        from column: "_from"         
        to column : "_to"
        date column : "_date"
        hour column : "_hour", sqlType : "numeric", precision : 18, scale : 5
        desc column : "_desc"
	}

}
